package com.bytes.activemq.topic;

import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

import javax.jms.JMSException;
import javax.jms.TextMessage;

@Component
public class Topic_Consumer {

	//持久订阅 离线之后消费之前未消费的消息
	@JmsListener(destination = "${my.topic.name}", containerFactory = "jmsListenerContainerFactory")
	//非持久订阅 离线之后不能消费之前未消费的消息
	//@JmsListener(destination = "${my.topic.name}")
	public void consumer(TextMessage textMessage) throws JMSException {
		System.out.println("订阅着收到消息:    " + textMessage.getText());
	}

}


